﻿using System;
using System.Collections.Generic;

class InaBoyfriend
{
    static void Main()
    {
        int size = int.Parse(Console.ReadLine());
        List<string[]> matrix = new List<string[]>();

        for (int i = 0; i < size; i++)
        {
            matrix.Add(new string[2]);
            matrix[i] = Console.ReadLine().Split(' ');
        }

        int mostLikes = 0;
        string mostLikedFriend = String.Empty;

        for (int row = 0; row < size; row++)
        {
            int tempLikes = 0;
            string friend = String.Empty;

            for (int col = 0; col < size; col++)
            {
                if (matrix[row][1][col] == '1')
                {
                    tempLikes++;
                }
            }

            if (mostLikes < tempLikes)
            {
                mostLikes = tempLikes;
                mostLikedFriend = matrix[row][0];
            }
        }

        Console.WriteLine(mostLikedFriend);
    }
}